<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/9/30
 * Time: 11:08
 */
namespace app\admin\model;
use think\Controller;
use think\Model;
use think\Db;
class Banner extends Model
{

    protected $name = 'banner';

    /**
     * 获取后台banner管理的总数
     * @param $where
     * @return int|string
     * @throws \think\Exception
     */
    public function getBannerCount($where)
    {
        return $this->where($where)->count();
    }

    public function getBannerList($where, $offset, $limit)
    {
        return $this->where($where)->limit($offset, $limit)->order('banner_id desc')->select();
    }

    /**
     * @param $where
     * @param $offset
     * @param $limit
     * @return false|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     *
     */
    public function getBannerpcList($where, $offset, $limit)
    {
        return Db::name('banner_pc')->where($where)->limit($offset, $limit)->order('banner_id desc')->select();
    }

    /**
     * @param $where
     * @return int|string
     */
    public function getBannerpcCount($where)
    {
        return Db::name('banner_pc')->where($where)->count();
    }
}